package cn.lintcode;

/**
 * @author labvi
 * @version 1.0.0
 * 157 字符串中的字符是否均唯一出现
 *  "abc" -> true
 *  "abc___" -> false
 */
public class UniqueCharacter {
    public boolean isUnique(String str) {
        // write your code here
        if (str.length() < 2) {
            return true;
        }

        for (int i = 0;i < str.length() ;i++ ){
            char a = str.charAt(i);
            if (str.indexOf(a) != str.lastIndexOf(a)) {
                return false;
            }

        }
        return true;
    }
    public static void main(String[] args) {
        UniqueCharacter uniqueCharacter = new UniqueCharacter();
        System.out.println(uniqueCharacter.isUnique("abc"));
    }
}
